package elements.axis; 
import string.Utils;

class YLabelStyle
{
	
	public var style:Dynamic;

	public function new( json:Dynamic, name:String )
	{

		this.style = {	size: 10,
						colour: 0x000000,
						show_labels: true
						};

		var comma:Float;
		var none:Float;
		var arr:Array<Dynamic>;
		
		if( json[name+'_label_style'] == undefined )
			return;
				
		// is it CSV?
		comma = json[name+'_label_style'].lastIndexOf(',');
			
		if( comma<0 )
		{
			none = json[name+'_label_style'].lastIndexOf('none',0);
			if( none>-1 )
			{
				this.style.show_labels = false;
			}
		}
		else
		{
			arr = json[name+'_label_style'].split(',');
			if( arr.length > 0 )
				this.style.size = arr[0];
				
			if( arr.length > 1 )
				this.style.colour = Utils.get_colour(arr[1]);
		}
	}
}
